<?php
include './function.php';

$files_arr = _readdir("./tpl/");

foreach ($files_arr as $key => $value) {
	$file = "./tpl/{$value}";
	$mark_arr[$value] = get_mark($file);
}


//echo json_encode($_POST); 

if (isAjax()) {
	if (!isset($_POST['inputtpl']) or empty($_POST['inputtpl'])) {
		return FALSE;
	}

	$key = $_POST['inputtpl'];

	if (!isset($mark_arr[$key]) or empty($mark_arr[$key])) {
		return FALSE;
	}

	echo json_encode($mark_arr[$key]); 
}
//print_r($mark_arr);

/*
print_r($mark_arr);
$str =  file_get_contents("./tpl/input.html") ;
$reparr = array('name' => 'username', 'title' => 'ÓÃ»§Ãû' );
echo string_replace($str, $reparr);
*/
